import Vue from 'vue'
import Vuex from 'vuex'
import ShowLoginModal from './ShowLoginModal/index.js'
import LoginStatus from './LoginStatus/index.js'
import toastStatus from './toastStatus/index.js'

Vue.use(Vuex)
const state = {
  cartList: [],
};
const store = new Vuex.Store({
  state,
  modules: {
    ShowLoginModal, LoginStatus, toastStatus
  },
  mutations:{
    addToCart(state, payload){
      // console.log('执行');
      state.cartList.push(payload)
      sessionStorage.setItem('user', JSON.stringify(state.cartList));
      // console.log(state.cartList);
      // console.log('执行');
    }
  },
}
)
export default store;